package cs236369.webserver.DTOs;

import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;

public class HandlerMapping {
	
	private final String handlerClassName;
	private final Map<String,String> parameters;
	private final Collection<String> extentions;
	
	public HandlerMapping(String handlerClassName, 
						  Map<String,String> parameters,
						  Collection<String> extentions) {
		super();
		this.handlerClassName = handlerClassName;
		this.parameters = parameters;
		this.extentions = extentions;
	}

	public String getHandlerClassName() {
		return handlerClassName;
	}
	
	public Map<String,String> getParameters() {
		return parameters;
	}
	
	public Collection<String> getExtentions() {
		return extentions;
	}
	
	@Override
	public String toString() {
		String res = "Handler Mapping:\n";
		res += ("Class: " + handlerClassName + "\n");
		res += "Parameters:\n";
		for(Entry<String,String> me : parameters.entrySet()) {
			res += ("\t" + me.getKey() + " = " + me.getValue() +"\n");
		}
		res += "Extentions:\n";
		for(String s : extentions) {
			res += ("\t" + s + "\n");
		}
		return res;
	}
}
